package com.xuecheng.filesystem.controller;

import com.xuecheng.api.filesystem.FileSysyemControllerApi;
import com.xuecheng.filesystem.service.FileSystemService;
import com.xuecheng.framework.domain.filesystem.response.UploadFileResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author jl
 * @description
 * @date 2019-08-30 13:57
 */
@RestController
@RequestMapping("/filesystem")
public class FileSystemController implements FileSysyemControllerApi {
    @Autowired
    private FileSystemService fileSystemService;

    @Override
    @PostMapping("/upload")
    public UploadFileResult uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("businesskey") String businesskey,@RequestParam("filetag") String filetag,@RequestParam("metadata") String metadata) {
        return fileSystemService.uploadFile(file,businesskey,filetag,metadata);
    }
}
